<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('未匹配数据列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <input type="hidden" id="assetId" th:value="${assetSyncId}">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <input type="text" name="searchParam" placeholder="资产编码/名称/型号"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "asset/assetDetail";

    $(function() {
        var options = {
            url: prefix + "/syncList",
            modalName: "未匹配数据列表",
            columns: [
                {
                    title: "序号",
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'assetName',
                    title : '资产名称'
                },
                {
                    field : 'assetCode',
                    title : '资产编码'
                },
                {
                    field : 'specifications',
                    title : '规格'
                },
                {
                    field : 'assetModel',
                    title : '型号'
                },
                {
                    field : 'amount',
                    title : '数量'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="sync(\'' + row.id + '\')"><i class="fa fa-edit"></i>手动关联</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function sync(id) {
        $.operate.save(prefix + "/sync",{assetId:$("#assetId").val(),cliqueId:id},function () {

        });
    }
    function submitHandler() {
        $.modal.close(layer.index);
    }
</script>
</body>
</html>